gtk: fix weed_out_neg_zero() in spinbutton and scale
authorMichael Natterer <mitch@gimp.org>
Mon, 3 Jun 2019 00:22:20 +0000 (00:22 +0000)
committerBenjamin Otte <otte.benjamin@googlemail.com>
Mon, 3 Jun 2019 00:34:44 +0000 (00:34 +0000)
It was not copying the terminating \0 in the string, breaking output
in spinbutton (didn't try scale). Fixes #3452.

(cherry picked from commit ae2ef1472c69ad61ed8d19d932da4ca04c2a13ef)

gtk/gtkscale.c
gtk/gtkspinbutton.c

index 70369410bf89e7c327960baa0bfb5feeae181a82..887af19200fc34276d98bac46f89cc7a090d4942 100644 (file)
@@ -1544,7 +1544,7 @@ weed_out_neg_zero (gchar *str,
       gchar neg_zero[8];
       g_snprintf (neg_zero, 8, "%0.*f", digits, -0.0);
       if (strcmp (neg_zero, str) == 0)
-        memmove (str, str + 1, strlen (str) - 1);
+        memmove (str, str + 1, strlen (str));
     }
   return str;
 }
index e4ddfaecb6a0333ed4e5957d1f1129ba346ef438..e673bd3a0327716d6414c392ecf87f34bc740287 100644 (file)
@@ -1101,7 +1101,7 @@ weed_out_neg_zero (gchar *str,
       gchar neg_zero[8];
       g_snprintf (neg_zero, 8, "%0.*f", digits, -0.0);
       if (strcmp (neg_zero, str) == 0)
-        memmove (str, str + 1, strlen (str) - 1);
+        memmove (str, str + 1, strlen (str));
     }
   return str;
 }